﻿using System;
class StringWordInf
{
    static void Main()
    {
        int index = 0;
        int result = 0;
        int curPosit = 0;
        string text = "ABBA own making In the future lamal Environmental destruction will be the nor";
        string[] words = text.Split(new char[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries);
        for (int i = 0; i < words.Length; i++)
        {
            result = 0;
            for (int j = 0; j < text.Length - words[i].Length; j++)
            {
                index = text.IndexOf(words[i], curPosit);
                if (index != -1)
                {
                    result++;
                    curPosit = index + words[i].Length; ;
                }
                else
                {
                    break;
                }
            }
            curPosit = (text.IndexOf(words[i],0)+words[i].Length);
            Console.WriteLine("{0}, {1}", result,words[i]);

        }
        Console.ReadLine();
    }
}

